<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    class People {
        like = '学习'
        constructor(name, age, sex) {
            this.name = name;
            this.age = age;
            this.sex = sex;
        }
        say() {
            console.log("我是中国人")
        }
    }
    let p = new People("张三", 18, "男");
    console.log(p)
    // 类的继承 extends 继承
    class Teacher extends People {
        constructor(name, age, sex, job) {
            // 完成继承 必须调用super函数
            super(name, age, sex);
            this.job = job;
        }
    }
    let t = new Teacher("李四", 28, "女", "前端");
    console.log(t)
    t.say();
</script>

</html>